home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PASCALL / TEMPJUNK / DRAW.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-19  |  899b  |  53 lines

  1. program draw;
  2. uses
  3.      crt,graph;
  4. const
  5.      x:integer=320;
  6.      y:integer=240;
  7.  
  8.  
  9. procedure setupgraph;
  10. var
  11.      graphdriver,graphmode:integer;
  12. begin
  13.      graphdriver:=mcga;
  14.      graphmode:=mcgahi;
  15.      initgraph(graphdriver,graphmode,'c:\tp\bgi');
  16.      if graphresult<>grOk then halt;
  17.      cleardevice;
  18. end;
  19.  
  20. procedure setpoint(a:char);
  21. const
  22.      numbers=['0'..'9'];
  23. begin
  24.      if not(a in numbers) then exit;
  25.      case a of
  26.           '1'..'3': y:=y+1;
  27.           '4'..'6': y:=y;
  28.           '7'..'9': y:=y-1;
  29.      end;
  30.      case a of
  31.           '1','4','7': x:=x-1;
  32.           '2','5','8': x:=x;
  33.           '3','6','9': x:=x+1;
  34.      end;
  35. end;
  36.  
  37. procedure control;
  38. var
  39.      a:char;
  40. begin
  41.      setupgraph;
  42.      repeat
  43.           a:=readkey;
  44.           setpoint(a);
  45.           putpixel(x,y,white);
  46.      until upcase(a)='S';
  47. end;
  48.  
  49.  
  50.  
  51. begin
  52.      control;
  53. end.